<Project Sdk="Microsoft.Build.NoTargets">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
    <!-- IncludeBuildOutput needs to be set to true to make NuGet include the passed in debug symbol files. -->
    <IncludeBuildOutput>true</IncludeBuildOutput>
    <IsPackable>true</IsPackable>
    <AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>$(SymbolsSuffix)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>
    <!-- When KeepNativeSymbols is set, debug symbols are kept in the .so files.  Separate symbol files do not exist that need to be packed. -->
    <TargetsForTfmSpecificDebugSymbolsInPackage Condition="'$(KeepNativeSymbols)' != 'true'">$(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificNativeSymbolToPackage</TargetsForTfmSpecificDebugSymbolsInPackage>
    <UseRuntimePackageDisclaimer>true</UseRuntimePackageDisclaimer>
    <!-- This is a native package and doesn't contain any ref/lib assets. -->
    <NoWarn>$(NoWarn);NU5128</NoWarn>
    <!-- Disabling baseline validation since this is  binary blob -nd we do not need API compat. -->
    <DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
  </PropertyGroup>

  <ItemGroup>
    <None Include="$(NativeBinDir)$(LibPrefix)System.IO.Ports.Native$(LibSuffix)"
          PackagePath="runtimes/$(OutputRID)/native"
          Pack="true" />
  </ItemGroup>

  <Target Name="AddRuntimeSpecificNativeSymbolToPackage">
    <ItemGroup>
      <TfmSpecificDebugSymbolsFile Include="$(NativeBinDir)$(LibPrefix)System.IO.Ports.Native$(LibSuffix)$(SymbolsSuffix)"
                                   TargetPath="/runtimes/$(OutputRID)/native"
                                   TargetFramework="$(TargetFramework)" />
    </ItemGroup>
  </Target>
</Project>
